/**************************************************************************
 * @doc RS232Com
 * @module Rs232.H - Header code for Rs232 communication handling functions.|  
 * Header code for Rs232 Communication handling functions.
 *
 * Product     :   SoftPay 2000 (Global Payment Methodology).
 * <nl>Developer   :   SoftPay Development Team (I_SP2000).
 * <nl>Notes       :
 *
 * @head3 Rs232 Functions |
 * @index | Rs232Com
 * @end
 *
 * Copyright (c) 1996-2000 by VeriFone Inc. All rights reserved.
 * 
 * No part of this software may be used, stored, compiled, reproduced,
 * modified, transcribed, translated, transmitted, or transferred, in any form 
 * or by any means whether electronic, mechanical, magnetic, optical, 
 * or otherwise, without the express prior written permission of VeriFone, Inc.
 *
 * Revision History
 * ------------------------------------------------------------------------
 $Log: /SoftPay/SPK2SIM/Source/Include/Rs232.h $
 * 
 * 7     3/19/00 8:06p Jim_b4
 * 
 * 6     3/16/00 6:34p Jim_b4
 * Code security functionality added
 * 
 * 5     11/11/99 11:34a Dom_b1
 * Completed SendComPacket() and RecvCModePacket().
 * 
 * 2     11/04/99 10:12p Sadiq_m1
 *
 * $log: 10/31/1999     8:45p  Sadiq_m1    Initial version $  
 * ------------------------------------------------------------------------
 ********************************************************************************/
#ifndef RS232_DEFINED
#define RS232_DEFINED

/* Definitions for sizes */

#define SEND_BUF_SIZE 256
#define RECV_BUF_SIZE 256

/* Definitions for various error types */

#define ERR_COM_OPEN                    (-10) /* port open failed                   */
#define ERR_COM_INIT                    (-11) /* Error setting port parameters      */
#define ERR_COM_CLOSE                   (-12) /* port close failed                  */
#define ERR_COM_SEND                    (-13) /* Write to Com port failed           */
#define ERR_COM_NAK                     (-14) /* Did not receive ACK for last write */
#define ERR_COM_READ                    (-15) /* Error setting port parameters      */
#define ERR_COM_WRITE                   (-16) /* Error setting port parameters      */
#define ERR_COM_TIMEOUT                 (-17) /* Error setting port parameters      */
#define ERR_COM_RECV                    (-18) /* Error setting port parameters      */


/* Prototype Definitions */

int inOpenComPort(const char *szPortName, struct Opn_Blk *psrOpnBlk);

int inCloseComPort(int inHandle);

int inSendComPacket(int inHandle, char *pchMsg, int inMsgSize, VS_BOOL fPadStxEtx, int inACKTimeOut, VS_BOOL fWaitForAck, int inMaxRetries);

int inRecvPModePacket(int inHandle, char *pchMsg, int inMaxMsgSize, VS_BOOL fValidate, int inRespTimeOut, int inMaxRetries);

int inRecvCModePacket(int inHandle, char *pchMsg, int inMaxRecSize, VS_BOOL fStripStxEtx, 
                      int inRespTimeOut, VS_BOOL fSendAck, int inMaxRetries);

unsigned char ucGetLRC(char *pucPacket, int inSize);

int inValidatePacket(char *pucPkt, int inSize);

int RS232_CODE_CHECK(char * a,char *b,short  *  c,char * d,unsigned char * e);

#endif /* RS232_DEFINED */
